package com.w.waiagent.common;

import com.w.waiagent.exception.ErrorCode;

/**
 * @author wzp
 * @since 2024/12/7
 */
public class ResultUtils {

    public static <T> BaseResponse<T> success() {
        return success("ok", null);
    }

    public static <T> BaseResponse<T> success(String message) {
        return success(message, null);
    }

    public static <T> BaseResponse<T> success(T data) {
        return success("ok", data);
    }

    public static <T> BaseResponse<T> success(String message, T data) {
        return new BaseResponse<>(0, message, data);
    }


    public static BaseResponse<?> error(ErrorCode errorCode, String message) {
        return error(errorCode.getCode(), message);
    }

    public static BaseResponse<?> error(int code, String message) {
        return new BaseResponse<>(code, message);
    }

    public static BaseResponse<?> error(ErrorCode errorCode) {
        return new BaseResponse<>(errorCode);
    }
}
